{% extends "base.html" %}

{% block title %}汽车品牌列表 - 汽车品牌互动平台{% endblock %}

{% block content %}
    <div class="row mb-4">
        <div class="col">
            <h1>汽车品牌列表</h1>
            <p class="text-muted">浏览热门汽车品牌，参与评论和投票</p>
        </div>
    </div>

    {% if car_brands %}
        <div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
            {% for brand in car_brands %}
                <div class="col">
                    <div class="card brand-card h-100">
                        {% if brand.image_url %}
                            <img src="{{ url_for('static', filename=brand.image_url) }}" 
                                 class="card-img-top brand-image" 
                                 alt="{{ brand.name }}">
                        {% else %}
                            <div class="bg-light d-flex align-items-center justify-content-center brand-image">
                                <i class="bi bi-car-front fs-1 text-muted"></i>
                            </div>
                        {% endif %}
                        <div class="card-body">
                            <h5 class="card-title">{{ brand.name }}</h5>
                            <p class="card-text">
                                <small class="text-muted">
                                    <i class="bi bi-flag me-1"></i>{{ brand.country }}
                                    {% if brand.founded_year %}
                                        · <i class="bi bi-calendar me-1"></i>{{ brand.founded_year }}年创立
                                    {% endif %}
                                </small>
                            </p>
                            <p class="card-text">{{ brand.description|truncate(100) }}</p>
                        </div>
                        <div class="card-footer bg-transparent d-flex justify-content-between align-items-center">
                            <div>
                                <span class="badge bg-primary">
                                    <i class="bi bi-bar-chart-line me-1"></i>{{ brand.total_votes }} 票
                                </span>
                                <span class="badge bg-secondary ms-1">
                                    <i class="bi bi-chat-left me-1"></i>{{ brand.comment_count }} 评论
                                </span>
                            </div>
                            <a href="{{ url_for('brand_detail', brand_id=brand.id) }}" class="btn btn-sm btn-outline-primary">
                                查看详情
                            </a>
                        </div>
                    </div>
                </div>
            {% endfor %}
        </div>
    {% else %}
        <div class="alert alert-info">
            <i class="bi bi-info-circle me-2"></i>暂无汽车品牌数据，请联系管理员添加。
        </div>
    {% endif %}
{% endblock %}